﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style TargetType="DataGrid">
        <!--网格线颜色-->
        <Setter Property="CanUserResizeColumns" Value="false"/>
        <Setter Property="SelectionMode" Value="Single"/>
        <Setter Property="Background" Value="{x:Null}" />
        <Setter Property="BorderBrush" Value="{DynamicResource BorderColor}"/>
        <Setter Property="Foreground" Value="{DynamicResource FgColor}"/>
        <Setter Property="MinRowHeight" Value="25"/>
        <Setter Property="FontSize" Value="13"/>
        <Setter Property="BorderThickness" Value="0.5"/>
        <Setter Property="HorizontalGridLinesBrush">
            <Setter.Value>
                <SolidColorBrush Color="#d6c79b"/>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalGridLinesBrush">
            <Setter.Value>
                <SolidColorBrush Color="#d6c79b"/>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="DataGridColumnHeader"> 
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="BorderBrush" Value="#e6dbba"/>
        <Setter Property="Background" Value="#66F1F1F1"/>
        <Setter Property="BorderThickness" Value="0,0,1,1"/>
        <Setter Property="MinHeight" Value="28" />   
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="DataGridColumnHeader">
                    <Border x:Name="BackgroundBorder" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <ContentPresenter  Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            <Path x:Name="SortArrow" Visibility="Collapsed" Stretch="Fill" Grid.Column="1" Width="8" Height="8"
                              Margin="0,0,8,0"
                              VerticalAlignment="Center" 
                              Fill="Black" Data="F1 M 38.1789,60.8614L 19.186,37.7428L 38.1686,14.2229L 57.1718,37.7531L 38.1789,60.8614 Z"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers> 
                        <MultiTrigger>
                            <MultiTrigger.Conditions> 
                                <Condition Property="SortDirection" Value="Ascending" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
                            <Setter TargetName="SortArrow" Property="Height" Value="10" />
                            <Setter TargetName="SortArrow" Property="Data"
                                    Value="F1 M 34,57L 42,57L 42,32.25L 52,42.25L 52,31.75L 38,17.75L 24,31.75L 24,42.25L 34,32.25L 34,57 Z " />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions> 
                                <Condition Property="SortDirection" Value="Descending" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
                            <Setter TargetName="SortArrow" Property="Height" Value="10" />
                            <Setter TargetName="SortArrow" Property="Data"
                                    Value="F1 M 42,19.0002L 34,19.0002L 34,43.7502L 24,33.7502L 24,44.2502L 38,58.2502L 52,44.2502L 52,33.7502L 42,43.7502L 42,19.0002 Z " />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter> 
    </Style>

    <!-- Don't set the MinHeight or Height property, use the MinRowHeight or RowHeight property on DataGrid style! -->
    <!--
    <Style TargetType="{x:Type DataGridRow}">
        <Setter Property="Foreground" Value="#FF505356" />
        <Setter Property="Margin" Value="0" />
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="{DynamicResource AccentColorBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource AccentSelectedColorBrush}" />
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsSelected"
                               Value="True" />
                    <Condition Property="Selector.IsSelectionActive"
                               Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background"
                        Value="{DynamicResource AccentColorBrush2}" />
            </MultiTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Self}}"
                               Value="True" />
                    <Condition Binding="{Binding Path=SelectionUnit, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
                               Value="FullRow" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Background"
                        Value="{DynamicResource AccentColorBrush3}" />
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Self}}"
                               Value="True" />
                    <Condition Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Self}}"
                               Value="True" />
                    <Condition Binding="{Binding Path=SelectionUnit, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
                               Value="CellOrRowHeader" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Background"
                        Value="{DynamicResource AccentColorBrush3}" />
            </MultiDataTrigger>
            <Trigger Property="IsEnabled"
                     Value="False">
                <Setter Property="Foreground"
                        Value="{DynamicResource GrayBrush7}" />
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled"
                               Value="False" />
                    <Condition Property="IsSelected"
                               Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Background"
                        Value="{DynamicResource GrayBrush7}" />
                <Setter Property="Foreground"
                        Value="{DynamicResource AccentSelectedColorBrush}" />
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    -->
    
    <Style TargetType="{x:Type DataGridCell}">  
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush"  Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Padding"  Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridCell}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Content="{TemplateBinding Content}"
                                          ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                          Margin="{TemplateBinding Padding}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Foreground" Value="White" />
                <Setter Property="Background" Value="#FF6F8FF9" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground"  Value="{DynamicResource EnabledColor}" />
            </Trigger>
            <!--
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled"
                               Value="False" />
                    <Condition Property="IsSelected"
                               Value="True" />
                </MultiTrigger.Conditions>
                <Setter Property="Foreground"
                        Value="{DynamicResource AccentSelectedColorBrush}" />
            </MultiTrigger>
            -->
        </Style.Triggers>
    </Style>  
</ResourceDictionary>